package com.retail.task;

import cn.hutool.core.date.DateUtil;
import com.retail.core.task.RetailQuartzJobBean;
import com.retail.order.entity.request.SysAdminVerifyRequest;
import com.retail.order.service.SysAdminVerifyService;
import com.retail.system.service.CronTriggersService;
import com.retail.system.service.CronTriggersSynchroTimeService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;


/**
 * 核销
 *
 * @author Administrator
 */
@Component
@Slf4j
public class RetailVerifyJobTask extends RetailQuartzJobBean {
    @Autowired
    private CronTriggersService cronTriggersService;

    @Autowired
    private CronTriggersSynchroTimeService cronTriggersSynchroTimeService;

    @Autowired
    private SysAdminVerifyService sysAdminVerifyService;

    @Override
    protected CronTriggersService getCronTriggersService() {
        return cronTriggersService;
    }

    @Override
    protected CronTriggersSynchroTimeService getcronTriggersSynchroTimeService() {
        return cronTriggersSynchroTimeService;
    }

    @Override
    public void task(JobExecutionContext jobExecutionContext) {
        SysAdminVerifyRequest sysAdminVerifyRequest = new SysAdminVerifyRequest();
        sysAdminVerifyRequest.setRemark("系统月度核心");
        sysAdminVerifyRequest.setVerifyMonth(DateUtil.format(new Date(), "yyyy-MM"));
        sysAdminVerifyService.operUserMonthVerify(sysAdminVerifyRequest);
    }
}
